package com.example.consumer.receiver;

import com.example.consumer.config.RabbitConfig;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class MsgReceiver {
    //消息消费者

    /**
     *
     * 通过@RabbitListener(queues = RabbitConfig.QUEUE_NAME) 指定方法监听的消息队列，参数是队列名
     */
    @RabbitListener(queues = RabbitConfig.QUEUE_NAME)
    public void handleMsg(String msg){ //这个消费者 监听这个队列
        System.out.println(msg);
    }
}
